<?php
/**
 * Created by PhpStorm.
 * User: 钊鑫
 * Date: 2019/1/26
 * Time: 14:37
 */
namespace app\api\validate;

class Project extends Base
{
    protected $rule = [
        'id'            =>  'require',
        'project'       =>  'require',
        'field'         =>  'require|checknumber',
        'params'        =>  'require|checkdescride|checkpersonal',
    ];

    protected $message = [
        'id.require'                    =>  'ID不能为空！',
        'project.require'               =>  '项目名称不能为空！',
        'field.require'                 =>  '请至少选择一个领域！',
        'params.checkdescride'          =>  '项目描述不能为空！',
        'params.checkpersonal'          =>  '负责人简介不能为空！',
    ];

    //领域验证
    protected function checknumber($value){
        return (sizeof($value) > 0) ? true : false;
    }

    //项目描述验证
    protected function checkdescride($value){
        return (isset($value['descride']) && !empty($value['descride'])) ? true : false;
    }

    //负责人验证
    protected function checkpersonal($value){
        return (isset($value['personal']) && !empty($value['personal'])) ? true : false;
    }


}